const imgUtil = require("../../common/utils/imgUtil")

const cmd = require('node-cmd')



exports.setWallPaperByUrl = function (url, imgName) {
    try {
        imgUtil.downloadImg(url, imgName, (path) => {
            let theShell = `osascript -e 'tell application "Finder" to set desktop picture to POSIX file "${path}"'`
            cmd.run(theShell, function (err, data, stderr) {
                console.log(err, data, stderr)
            })
        })
    } catch (e) { console.info("e", e) }
}
